import { ColumnsRenderFun, DictionaryRenderFun, getSorter } from '@/common';
import { removeDateHmsStr } from '@/utils';

/** 表格配置 */
const intentManageColumn = () => {
  return [
    {
      title: '申请人部门', // 原【申请部门】
      dataIndex: 'createDepartmentName', // own
      key: 'createDepartmentName',
      visible: true,
      fixed: 'left',
      sorter: (a: any, b: any) => getSorter(a?.createDepartmentName, b?.createDepartmentName),
      width: 200,
      render: (text: string) => ColumnsRenderFun({ text, isTooltip: true }),
    },
    {
      title: '意向公开名称',
      dataIndex: 'intentName',
      sorter: (a: any, b: any) => getSorter(a?.intentName, b?.intentName),
      key: 'intentName',
      visible: true,
      width: 200,
      render: (text: string, record: Record<string, any>) => ColumnsRenderFun({ text, isTooltip: true }),
    },
    {
      title: '采购需求概述',
      dataIndex: 'purchaseInfo',
      key: 'purchaseInfo',
      width: 220,
      visible: true,
      sorter: (a: any, b: any) => getSorter(a?.purchaseInfo, b?.purchaseInfo),
      render: (text: string | null) => ColumnsRenderFun({ text, isTooltip: true }),
    },
    {
      title: '备注',
      dataIndex: 'remark',
      key: 'remark',
      width: 220,
      visible: true,
      sorter: (a: any, b: any) => getSorter(a?.remark, b?.remark),
      render: (text: string | null) => ColumnsRenderFun({ text, isTooltip: true }),
    },
    {
      title: '状态',
      dataIndex: 'stateName',
      key: 'stateName',
      width: 200,
      visible: true,
      sorter: (a: any, b: any) => getSorter(a?.state, b?.state),
      render: (text: string | null) => DictionaryRenderFun({ text, isState: true }),
    },
    {
      title: '意向公开时间',
      dataIndex: 'intentTime',
      key: 'intentTime',
      sorter: (a: any, b: any) => getSorter(a?.intentTime, b?.intentTime),
      width: 200,
      visible: true,
      render: (text: string) => <span>{text ? removeDateHmsStr(text) : '--'}</span>,
    },
    {
      title: '拟公告时间',
      dataIndex: 'announcementTime',
      key: 'announcementTime',
      sorter: (a: any, b: any) => getSorter(a?.announcementTime, b?.announcementTime),
      width: 200,
      visible: true,
      render: (text: string) => <span>{text ? removeDateHmsStr(text) : '--'}</span>,
    },
    {
      title: '创建人公司',
      dataIndex: 'createCompanyName',
      key: 'createCompanyName',
      sorter: (a: any, b: any) => getSorter(a?.createCompanyName, b?.createCompanyName),
      width: 200,
      visible: false,
      render: (text: string | null) => ColumnsRenderFun({ text, isTooltip: true }),
    },

    {
      title: '创建人部门',
      dataIndex: 'createDepartmentName',
      key: 'createDepartmentName',
      sorter: (a: any, b: any) => getSorter(a?.createDepartmentName, b?.createDepartmentName),
      width: 200,
      visible: false,
      render: (text: string | null) => ColumnsRenderFun({ text, isTooltip: true }),
    },
    {
      title: '创建人岗位',
      dataIndex: 'createPositionName',
      key: 'createPositionName',
      sorter: (a: any, b: any) => getSorter(a?.createPositionName, b?.createPositionName),
      width: 200,
      visible: false,
      render: (text: string | null) => ColumnsRenderFun({ text, isTooltip: true }),
    },
    {
      title: '创建人',
      dataIndex: 'createrName',
      key: 'createrName',
      sorter: (a: any, b: any) => getSorter(a?.createrID, b?.createrID),
      width: 200,
      visible: true,
      render: (text: string | null) => ColumnsRenderFun({ text, isTooltip: true }),
    },
    // {
    //     title: '联系电话',
    //     dataIndex: 'applyPhone',
    //     key: 'applyPhone',
    //     visible: true,
    //     sorter: (a: any, b: any) => getSorter(a?.applyPhone, b?.applyPhone),
    //     width: 200,
    //     render: (text: string) => ColumnsRenderFun({ text }),
    // },
    // {
    //     title: '申请时间',
    //     dataIndex: 'applyTime',
    //     key: 'applyTime',
    //     visible: false,
    //     width: 200,
    //     sorter: (a: any, b: any) => getSorter(a?.applyTime, b?.applyTime),
    //     render: (text: string) => <span>{removeDateHmsStr(text)}</span>,
    // },
    // {
    //     title: '申请人公司',
    //     dataIndex: 'applyCompanyName',
    //     key: 'applyCompanyName',
    //     width: 200,
    //     visible: false,
    //     sorter: (a: any, b: any) => getSorter(a?.applyCompanyID, b?.applyCompanyID),
    //     render: (text: string | null) => ColumnsRenderFun({ text, isTooltip: true }),
    // },
    // {
    //     title: '申请人部门',
    //     dataIndex: 'applyDepartmentName',
    //     key: 'applyDepartmentName',
    //     width: 200,
    //     visible: false,
    //     sorter: (a: any, b: any) => getSorter(a?.applyDepartmentID, b?.applyDepartmentID),
    //     render: (text: string | null) => ColumnsRenderFun({ text, isTooltip: true }),
    // },
    // {
    //     title: '申请人岗位',
    //     dataIndex: 'applyPositionName',
    //     key: 'applyPositionName',
    //     width: 200,
    //     visible: false,
    //     sorter: (a: any, b: any) => getSorter(a?.applyPositionID, b?.applyPositionID),
    //     render: (text: string | null) => ColumnsRenderFun({ text, isTooltip: true }),
    // },
    // {
    //     title: '申请人',
    //     dataIndex: 'applyerName',
    //     key: 'applyerName',
    //     width: 200,
    //     visible: false,
    //     sorter: (a: any, b: any) => getSorter(a?.applyerID, b?.applyerID),
    //     render: (text: string | null) => ColumnsRenderFun({ text, isTooltip: true }),
    // },
  ];
};

export { intentManageColumn };
